<template>
  <div id="app">
    <router-view v-if="isRouterAlive"/>
  </div>
</template>

<script>
import { cxLogin } from "./api/minuteReportApi";
export default {
  name: 'App',
  provide () {
    return {
      reload: this.reload,
      timer: null
    }
  },
  data () {
    return {
      isRouterAlive: true,
      payload: {
        account: "admin",
        password: "sdl@20230403",
      },
    }
  },
  mounted () {
    this.login101(),
    this.timer = setInterval(() => {
      this.reload()
    }, 390000)
  },
  destroyed () {
    clearInterval(this.timer)
  },
  methods: {
    reload () {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive = true
      })
    },
    login101(){
      cxLogin(this.payload).then((res) => {
        localStorage.setItem("cxLoginTToken", res.data.data.token);
      });
    }
  }
}
</script>

<style>

</style>
